Skip to content

Add Python scripting API for batch automation#53

Open
robtaylor wants to merge 1 commit intomainfrom
python-scripting-api
Open

Add Python scripting API for batch automation#53
robtaylor wants to merge 1 commit intomainfrom
python-scripting-api

Conversation

@robtaylor
Copy link
Contributor

Summary

  • Adds python/jacquard/ package — a subprocess wrapper around jacquard map and jacquard sim CLI for batch automation, regression testing, and result analysis
  • JacquardConfig dataclass mirrors the Rust jacquard.toml structure with from_toml()/to_toml() round-trip support
  • Structured result parsing for === Design Statistics === and === Simulation Summary === CLI output blocks
  • Batch regression runner with concurrent.futures.ProcessPoolExecutor for parallel test execution
  • **overrides pattern for parameter sweeps without mutating config objects
  • Zero external dependencies (stdlib only: subprocess, tomllib, dataclasses, concurrent.futures)

Package structure

python/jacquard/
├── pyproject.toml
├── src/jacquard/
│   ├── __init__.py      # Public API exports
│   ├── config.py        # JacquardConfig + TOML I/O
│   ├── runner.py        # map(), sim() subprocess wrappers
│   ├── result.py        # DesignStats, MapResult, SimResult
│   ├── regression.py    # TestCase, RegressionReport, run_regression()
│   └── errors.py        # JacquardError hierarchy
└── tests/
    ├── test_config.py
    ├── test_runner.py
    └── test_regression.py

Test plan

  • uv sync --group dev resolves cleanly
  • ruff check src/ tests/ — all checks passed
  • pytest tests/ -v — 47 tests passing
  • Manual integration test with built jacquard binary (requires GPU)

Subprocess wrapper around `jacquard map` and `jacquard sim` CLI with:
- JacquardConfig dataclass mirroring the Rust jacquard.toml structure
- Structured result parsing for Design Statistics and Simulation Summary
- Batch regression runner with parallel execution via ProcessPoolExecutor
- Config override support for parameter sweeps without modifying config objects
- 47 unit tests covering config round-trip, CLI arg building, output parsing,
  and regression runner logic

Co-developed-by: Claude Code v2.1.50 (claude-opus-4-6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant